 

package com.zdkj.subway.stm.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdkj.common.core.util.R;
import com.zdkj.common.log.annotation.SysLog;
import com.zdkj.subway.stm.entity.SwStTicketCheckOnewayPressure;
import com.zdkj.subway.stm.service.SwStTicketCheckOnewayPressureService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 车票盘点数据(单程票压票)
 *
 * @author songtuo
 * @date 2020-07-11 22:08:19
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swstticketcheckonewaypressure" )
@Api(value = "swstticketcheckonewaypressure", tags = "车票盘点数据(单程票压票)管理")
public class SwStTicketCheckOnewayPressureController {

    private final  SwStTicketCheckOnewayPressureService swStTicketCheckOnewayPressureService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param swStTicketCheckOnewayPressure 车票盘点数据(单程票压票)
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwStTicketCheckOnewayPressurePage(Page page, SwStTicketCheckOnewayPressure swStTicketCheckOnewayPressure) {
        return R.ok(swStTicketCheckOnewayPressureService.page(page, Wrappers.query(swStTicketCheckOnewayPressure)));
    }


    /**
     * 通过id查询车票盘点数据(单程票压票)
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(swStTicketCheckOnewayPressureService.getById(id));
    }

    /**
     * 新增车票盘点数据(单程票压票)
     * @param swStTicketCheckOnewayPressure 车票盘点数据(单程票压票)
     * @return R
     */
    @ApiOperation(value = "新增车票盘点数据(单程票压票)", notes = "新增车票盘点数据(单程票压票)")
    @SysLog("新增车票盘点数据(单程票压票)" )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('generator_swstticketcheckonewaypressure_add')" )
    public R save(@RequestBody SwStTicketCheckOnewayPressure swStTicketCheckOnewayPressure) {
        return R.ok(swStTicketCheckOnewayPressureService.save(swStTicketCheckOnewayPressure));
    }

    /**
     * 修改车票盘点数据(单程票压票)
     * @param swStTicketCheckOnewayPressure 车票盘点数据(单程票压票)
     * @return R
     */
    @ApiOperation(value = "修改车票盘点数据(单程票压票)", notes = "修改车票盘点数据(单程票压票)")
    @SysLog("修改车票盘点数据(单程票压票)" )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('generator_swstticketcheckonewaypressure_edit')" )
    public R updateById(@RequestBody SwStTicketCheckOnewayPressure swStTicketCheckOnewayPressure) {
        return R.ok(swStTicketCheckOnewayPressureService.updateById(swStTicketCheckOnewayPressure));
    }

    /**
     * 通过id删除车票盘点数据(单程票压票)
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除车票盘点数据(单程票压票)", notes = "通过id删除车票盘点数据(单程票压票)")
    @SysLog("通过id删除车票盘点数据(单程票压票)" )
    @DeleteMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('generator_swstticketcheckonewaypressure_del')" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(swStTicketCheckOnewayPressureService.removeById(id));
    }

}
